home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
eflibpt4.zip
/
DEMO
/
DATATYPE
/
STACK2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-08-18
|
1KB
|
40 lines
{ Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
Demonstration; dynamic stacks #2
EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED. }
uses EFLIBDEF, EFLIBINI, EFLIBDAT, EFLIBOBJ, EFLIBSCR, EFLIBTXT;
const NumberOfElements = 1000;
var Index, Number : integer;
MyStack : StackObjectType;
begin
WriteLn ('* Stack demonstration *');
{ Initialize dynamic stack and push integer numbers to stack }
with MyStack do begin
{ Initialize a dynamic stack }
InitializeStack (SizeOf(Integer), FALSE);
{ Element size } { Unrestricted access (overflow checking) }
{ Push (add) some numbers ... }
for Index := NumberOfElements downto 1 do Push (Index);
{ Pop (retrieve) numbers ... }
while not IsEmpty do begin
Pop (Number);
Write (Number:5);
end;
WriteLn;
Intercept;
end;
if GlobalDataError then WriteLn ('Error(s) reported!');
end.